<?php

use think\facade\Route;

$domain = ['Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With, token, sign'];

/**
 * 申请商家
 */
Route::group('villageBusinessApply', function () {
    Route::get('/index', 'villageBusinessApply/index');
    Route::post('/add', 'villageBusinessApply/add');
})->middleware('verify');

/**
 * 商家中心首页
 */
Route::group('villageBusiness', function () {
    Route::get('/index', 'villageBusiness/index');
    Route::get('/read', 'villageBusiness/read');
    Route::get('/getCate/:pid', 'villageBusiness/getCate');
    Route::post('/save', 'villageBusiness/save');
    Route::get('/census', 'villageBusiness/census');
    Route::get('/draw', 'villageBusiness/draw');
    Route::post('/drawApply', 'villageBusiness/drawApply');
    Route::get('/drawRecord', 'villageBusiness/drawRecord');
    Route::get('/fundsFlow', 'villageBusiness/fundsFlow');
    Route::get('/fundsInfo', 'villageBusiness/fundsInfo');
    Route::post('/videoApply', 'villageBusiness/videoApply');
})->middleware('verifyVillageBusiness');

/**
 * 商家中心 - 规格管理
 */
Route::group('villageBusinessSpec', function () {
    Route::get('/index', 'villageBusinessSpec/index');
    Route::get('/read/:id', 'villageBusinessSpec/read');
    Route::post('/createSku', 'villageBusinessSpec/createSku');
    Route::post('/save', 'villageBusinessSpec/save');
    Route::delete('/delete/:id', 'villageBusinessSpec/delete');
})->middleware('verifyVillageBusiness');


/**
 * 商家中心 - 商品管理
 */
Route::group('villageBusinessProduct', function () {
    Route::get('/index', 'villageBusinessProduct/index');
    Route::get('/read/:id', 'villageBusinessProduct/read');
    Route::get('/getSpec/:id', 'villageBusinessProduct/getSpec');
    Route::get('/getCateSpec/:cate_2', 'villageBusinessProduct/getCateSpec');
    Route::get('/getService', 'villageBusinessProduct/getService');
    Route::post('/save', 'villageBusinessProduct/save');
    Route::post('/update', 'villageBusinessProduct/update');
    Route::post('/updateStock', 'villageBusinessProduct/updateStock');
})->middleware('verifyVillageBusiness');

/**
 * 商家中心 - 订单管理
 */
Route::group('villageBusinessOrder', function () {
    Route::get('/index', 'villageBusinessOrder/index');
    Route::get('/info/:id', 'villageBusinessOrder/info');
    Route::get('/deliverFront/:id', 'villageBusinessOrder/deliverFront');
    Route::post('/deliverSave', 'villageBusinessOrder/deliverSave');
    Route::get('/getRefundOrder', 'villageBusinessOrder/getRefundOrder');
    Route::get('/getRefundOrderInfo/:id', 'villageBusinessOrder/getRefundOrderInfo');
    Route::post('/editRefundOrder', 'villageBusinessOrder/editRefundOrder');
    Route::get('/getEvaluate', 'villageBusinessOrder/getEvaluate');
    Route::get('/getEvaluateInfo/:id', 'villageBusinessOrder/getEvaluateInfo');
    Route::get('/getWriteOffOrder/:code', 'villageBusinessOrder/getWriteOffOrder');
    Route::post('/replyEvaluate', 'villageBusinessOrder/replyEvaluate');
    Route::post('/confirmWriteOff', 'villageBusinessOrder/confirmWriteOff');
})->middleware('verifyVillageBusiness');

/**
 * 视频相关
 */
Route::group('villageBusinessVideo', function () {
    Route::post('/store', 'villageBusinessVideo/store');
    Route::get('/token', 'villageBusinessVideo/token');
    Route::get('/index', 'villageBusinessVideo/index');
    Route::get('/info', 'villageBusinessVideo/info');
    Route::get('/product', 'villageBusinessVideo/product');
    Route::delete('/del', 'villageBusinessVideo/del');
    Route::get('/hitList', 'villageBusinessVideo/hitList');
    Route::get('/commentList', 'villageBusinessVideo/commentList');
    Route::post('/delComment', 'villageBusinessVideo/delComment');
    Route::post('/commentDelOrder', 'villageBusinessVideo/commentDelOrder');
    //Route::post('/addTag', 'villageBusinessVideo/addTag');
    Route::get('/tagList', 'villageBusinessVideo/tagList');
})->middleware('verifyVillageBusiness');

